load("//bazel:mongo_src_rules.bzl", "mongo_cc_benchmark", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

# Core geometry shape libraries
mongo_cc_library(
    name = "geometry",
    srcs = [
        "big_polygon.cpp",
        "hash.cpp",
        "r2_region_coverer.cpp",
        "shapes.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:common",
        "//src/mongo/db/storage/key_string",
        "//src/third_party/s2",
    ],
)

# Geometry / BSON parsing and wrapping
mongo_cc_library(
    name = "geoparser",
    srcs = [
        "geometry_container.cpp",
        "geoparser.cpp",
    ],
    deps = [
        ":geometry",
        "//src/mongo:base",
        "//src/mongo/bson/dotted_path:dotted_path_support",
        "//src/mongo/db/query/bson:multikey_dotted_path_support",
        "//src/third_party/s2",
    ],
)

mongo_cc_unit_test(
    name = "db_geo_test",
    srcs = [
        "big_polygon_test.cpp",
        "geoparser_test.cpp",
        "hash_test.cpp",
        "r2_region_coverer_test.cpp",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":geometry",
        ":geoparser",
        "//src/mongo/db:common",
    ],
)

mongo_cc_benchmark(
    name = "hash_bm",
    srcs = [
        "hash_bm.cpp",
    ],
    deps = [
        ":geometry",
    ],
)
